<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <!-- 作用: 内容分发 -->

      <!-- 用slot的标签来接受子组件标签中间的内容 -->
      <!-- 插槽也可以做父传子 -->
      <!-- 不仅可以插入变量，还可以插入标签甚至组件 -->

      <h3>插槽基础</h3>
      <!-- <child>{{ count }}</child> -->
      <!-- <child :count="count"></child> -->

      <!-- <child><span>123</span></child> -->

      <child><child2></child2></child>
    </div>

    <script src="./lib/vue3.js"></script>
    <script>
      const { createApp } = Vue;

      const Child2 = {
        template: `
          <div>child2子组件</div>
        `,
      };

      const Child = {
        // props: ["count"],
        template: `
        
          <div>child子组件 - <slot></slot></div>
        `,
      };

      createApp({
        data() {
          return {
            count: 10,
          };
        },
        components: {
          Child,
          Child2,
        },
      }).mount("#app");
    </script>
  </body>
</html>
